{% extends 'home/template.html' %}

{% load i18n %}
{% load martortags %}
{% load bleach_tags %}

{% block title %} {% translate "Template Details" %} {% endblock title %}

{% block stylesheets %}
  {{ block.super }}
{% endblock stylesheets %}

{% block content %}
  
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>{% translate "Template Details" %}</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="/">{% translate "Home" %}</a></li>
              <li class="breadcrumb-item"><a href="{% url 'template_list' %}">{% translate "Templates" %}</a></li>
              <li class="breadcrumb-item active">{{ DB_Template.title | bleach}}</li>
            </ol>
          </div>
        </div>
      </div>
    </section>



  <section class="content">
    <div class="container-fluid">


      <div class="row">
        <div class="col-md-12">

            <div class="card card-outline card-danger">
                <div class="card-header">
                  <h3 class="card-title">
                    <i class="far fa-chart-bar"></i>
                    <b>{% translate "Summary" %}</b>
                  </h3>
                  <div class="card-tools">
                    <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                      <i class="fas fa-minus"></i>
                    </button>
                  </div>

                </div>
                <!-- /.card-header -->
                <div class="card-body">
                    
      
                  <div class="row">
                      <div class="col-12 col-sm-6">
                        <div class="info-box bg-light">
                          <div class="info-box-content">
                            <span class="info-box-number text-center text-muted">{% translate "Finding ID" %}</span>
                            <span class="info-box-text text-center text-muted mb-0">{{ DB_Template.finding_id }}</span>
                          </div>
                        </div>
                      </div>

                      <div class="col-12 col-sm-6">
                        <div class="info-box bg-light">
                          <div class="info-box-content">
                            <span class="info-box-number text-center text-muted">{% translate "Title" %}</span>
                            <span class="info-box-text text-center text-muted mb-0">{{ DB_Template.title | safe | bleach}}<span>
                          </div>
                        </div>
                      </div>

                    </div>



        
                    <div class="row">
                      <div class="col-12 col-sm-6">
                        <div class="info-box bg-light">
                          <div class="info-box-content">
                            <span class="info-box-number text-center text-muted">{% translate "CVSS Vector" %}</span>
                            <span class="info-box-text text-center text-muted mb-0">{{ DB_Template.cvss_vector | safe | bleach}}<span>
                        </div>
                        </div>
                      </div>

                      <div class="col-12 col-sm-3">
                        <div class="info-box bg-light">
                          <div class="info-box-content">
                            <span class="info-box-number text-center text-muted">{% translate "CVSS Score" %}</span>
                            <span class="info-box-text text-center text-muted mb-0">{{ DB_Template.cvss_score | safe | bleach}}<span>
                          </div>
                        </div>
                      </div>

                      <div class="col-12 col-sm-3">
                        <div class="info-box bg-light">
                          <div class="info-box-content">
                            <span class="info-box-number text-center text-muted">{% translate "Severity" %}</span>
                            <span class="info-box-text text-center text-muted mb-0">
                                {% if DB_Template.severity == "Critical" %}
                                      <span><b><font color="#cc0000">{{DB_Template.severity| safe | bleach}}</font></b></span>
                                  {% elif DB_Template.severity == "High" %}
                                      <span><b><font color="#ff403d">{{DB_Template.severity| safe | bleach}}</font></b></span>
                                  {% elif DB_Template.severity == "Medium" %}
                                      <span><b><font color="#fc7f03">{{DB_Template.severity| safe | bleach}}</font></b></span>
                                  {% elif DB_Template.severity == "Low" %}
                                      <span><b><font color="#05b04f">{{DB_Template.severity| safe | bleach}}</font></b></span>
                                  {% elif DB_Template.severity == "Info" %}
                                      <span><b><font color="#45a7f7">{{DB_Template.severity| safe | bleach}}</font></b></span>
                                  {% else %}
                                      <span><b>{{ DB_Template.cvss_score | safe | bleach}} - {{DB_Template.severity | safe | bleach}}</b></span> ({% translate "will not appear in the report" %})
                                {% endif %}
                          </span>
                          </div>
                        </div>
                      </div>


                    </div>




                    <div class="row">
                      <div class="col-12 col-sm-6">
                        <div class="info-box bg-light">
                          <div class="info-box-content">
                            <span class="info-box-number text-center text-muted">{% translate "CWE" %}</span>
                            <span class="info-box-text text-center text-muted mb-0">{{ DB_Template.cwe.cwe_id | safe | bleach}} - {{DB_Template.cwe.cwe_name |safe| bleach}}</span>
                          </div>
                        </div>
                      </div>

                      <div class="col-12 col-sm-6">
                        <div class="info-box bg-light">
                          <div class="info-box-content">
                            <span class="info-box-number text-center text-muted">{% translate "OWASP" %}</span>
                            <span class="info-box-text text-center text-muted mb-0">{{ DB_Template.owasp.owasp_id | safe | bleach}} - {{DB_Template.owasp.owasp_name |safe| bleach}}</span>
                          </div>
                        </div>
                      </div>
                  </div>




                  


                </div>
              </div>

        </div>
      </div> 



      <div class="row">
        <div class="col-md-12">

            <div class="card card-outline card-danger">
                <div class="card-header">
                  <h3 class="card-title">
                    <b>{% translate "Title" %}</b>
                  </h3>
                  <div class="card-tools">
                    <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                      <i class="fas fa-minus"></i>
                    </button>
                  </div>

                </div>
                <div class="card-body">
                  {{ DB_Template.title|safe_markdown | bleach }}
                </div>
              </div>

        </div>
      </div> 


      {% if DB_Template.description %}
      <div class="row">
        <div class="col-md-12">

            <div class="card card-outline card-danger">
                <div class="card-header">
                  <h3 class="card-title">
                   <b>{% translate "Description" %}</b>
                  </h3>
                  <div class="card-tools">
                    <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                      <i class="fas fa-minus"></i>
                    </button>
                  </div>

                </div>
                <div class="card-body">
                  {{ DB_Template.description|safe_markdown | bleach }}
                </div>
              </div>

        </div>
      </div> 
      {% endif %}



      {% if DB_Template.location %}
      <div class="row">
        <div class="col-md-12">

            <div class="card card-outline card-danger">
                <div class="card-header">
                  <h3 class="card-title">
                    <b>{% translate "Location" %}</b>
                  </h3>
                  <div class="card-tools">
                    <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                      <i class="fas fa-minus"></i>
                    </button>
                  </div>

                </div>
                <div class="card-body">
                  {{ DB_Template.location|safe_markdown | bleach }}
                </div>
              </div>

        </div>
      </div> 
      {% endif %}

      {% if DB_Template.impact %}
      <div class="row">
        <div class="col-md-12">

            <div class="card card-outline card-danger">
                <div class="card-header">
                  <h3 class="card-title">
                    <b>{% translate "Impact" %}</b>
                  </h3>
                  <div class="card-tools">
                    <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                      <i class="fas fa-minus"></i>
                    </button>
                  </div>

                </div>
                <div class="card-body">
                  {{ DB_Template.impact|safe_markdown | bleach }}
                </div>
              </div>

        </div>
      </div> 
      {% endif %}

      {% if DB_Template.recommendation %}
      <div class="row">
        <div class="col-md-12">

            <div class="card card-outline card-danger">
                <div class="card-header">
                  <h3 class="card-title">
                    <b>{% translate "Recommendation" %}</b>
                  </h3>
                  <div class="card-tools">
                    <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                      <i class="fas fa-minus"></i>
                    </button>
                  </div>

                </div>
                <div class="card-body">
                  {{ DB_Template.recommendation|safe_markdown | bleach }}
                </div>
              </div>

        </div>
      </div> 
      {% endif %}

      {% if DB_Template.references %}
      <div class="row">
        <div class="col-md-12">

            <div class="card card-outline card-danger">
                <div class="card-header">
                  <h3 class="card-title">
                    <b>{% translate "References" %}</b>
                  </h3>
                  <div class="card-tools">
                    <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                      <i class="fas fa-minus"></i>
                    </button>
                  </div>

                </div>
                <div class="card-body">
                  {{ DB_Template.references|safe_markdown | bleach}}
                </div>
              </div>

        </div>
      </div> 
      {% endif %}


      </div>
    </section>


{% endblock content %}

{% block javascripts %}
  {{ block.super }}
{% endblock javascripts %}
